<?php

namespace App\Home;

use Illuminate\Database\Eloquent\Model;

class Course extends Model
{
    protected $table = 'course';

    public function rel_lession(){
        //查询一对一的直播
        return $this -> hasOne('App\Home\Lession','course_id','id');
    }

    public function rel_lessions(){
        //查询一对多的连续剧
        return $this -> hasMany('App\Home\Lession','course_id','id') -> select('id','course_id','lession_name','description','cover_img','price','free','video_time') -> orderBy('sort','desc');
    }
}
